<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:constants="http://www.tuanzi.com/constants/tags">

<p:dialog header="开票信息" widgetVar="billing" modal="true" closable="true" resizable="true" style="position: absolute;">
    <p:outputPanel id="bill-dialog">
        <div class="ui-g-12 ui-fluid" style="width:1000px">
            <p:panelGrid columns="4" layout="grid"
                         columnClasses="ui-grid-col-1,ui-grid-col-5,ui-grid-col-1,ui-grid-col-5"
                         styleClass="ui-panelgrid-blank"
                         style="border:0px none; background-color:transparent;text-align:left;">
                <p:outputLabel value="主体名称"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.companyName}"/>

                <p:outputLabel value="开票内容"/>
                <p:selectOneMenu id="billContent" value="#{xhhSettlementPrepayListBean.settlementBill.billContent}">
                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                  noSelectionOption="true"/>
                    <f:selectItems
                            value="#{xhhSettlementPrepayListBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILLING_CONTENT]}"
                            var="dic"
                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                </p:selectOneMenu>

                <p:outputLabel value="登记税号"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.taxNumber}"/>

                <p:outputLabel value="发票类型"/>
                <p:selectOneMenu id="billType" value="#{xhhSettlementPrepayListBean.settlementBill.billType}">
                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                  noSelectionOption="true"/>
                    <f:selectItems value="#{xhhSettlementPrepayListBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILL_TYPE]}"
                                   var="dic"
                                   itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                </p:selectOneMenu>

                <p:outputLabel value="开户账户"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.bankAccount}"/>

                <p:outputLabel value="开户支行"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.bankAddress}"/>

                <p:outputLabel value="开户卡号"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.bankNumber}"/>

                <p:outputLabel value="开票地址"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.billAddress}"/>

                <p:outputLabel value="开票电话"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.companyPhone}"/>

                <p:outputLabel value="收件人姓名"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.receiveName}"/>

                <p:outputLabel value="收件人手机"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.receivePhone}"/>

                <p:outputLabel value="收件地址"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.receiveAddress}"/>
            </p:panelGrid>


            <div class="ui-g-12 padding0">
                <h2 style="font-weight: bold">预付明细</h2>
                <hr style="color: transparent"/>
            </div>

            <div class="ui-g-12 padding0">
                <p:dataTable var="record" value="#{xhhSettlementPrepayListBean.selectPrepayList}">
                    <p:column headerText="充值日期" style="text-align:center">
                        <h:outputText value="#{record.prepayTime}">
                            <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="主体名称" style="text-align:center;">
                        <h:outputText value="#{record.companyName}"/>
                    </p:column>

                    <p:column headerText="付款方式" style="text-align:center;">
                        <h:outputText
                                value="#{xhhSettlementPrepayListBean.translate(DictionaryCode.XHH_SETTLEMENT_PAY_MODE,record.payMode)}"/>
                    </p:column>

                    <p:column headerText="充值金额" style="text-align:center;">
                        <h:outputText value="#{record.prepayAmount}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="付款账户" style="text-align:center;">
                        <h:outputText value="#{record.payName}"/>
                    </p:column>

                    <p:column headerText="付款账号" style="text-align:center;">
                        <h:outputText value="#{record.payAccount}"/>
                    </p:column>

                    <p:column headerText="创建人" style="text-align:center;">
                        <h:outputText value="#{record.creator}"/>
                    </p:column>
                </p:dataTable>
            </div>
            <div class="ui-g-12 padding0">
                <hr style="color: transparent"/>
            </div>

            <p:panelGrid columns="4" layout="grid"
                         columnClasses="ui-grid-col-2,ui-grid-col-4,ui-grid-col-2,ui-grid-col-4"
                         styleClass="ui-panelgrid-blank"
                         style="border:0px none; background-color:transparent;text-align:left;">
                <p:outputLabel value="财务审核人"/>
                <p:selectOneMenu id="checkAccount" value="#{xhhSettlementPrepayListBean.settlementBill.checkAccount}"
                                 filter="true" updateLabel="true"
                                 filterMatchMode="contains">
                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                  noSelectionOption="true"/>
                    <f:selectItems value="#{xhhSettlementPrepayListBean.checkList}"
                                   var="dic"
                                   itemLabel="#{dic.name}" itemValue="#{dic.account}"/>
                </p:selectOneMenu>

                <p:outputLabel value="总预付金额"/>
                <p:inputNumber value="#{xhhSettlementPrepayListBean.settlementBill.billAmount}"/>

            </p:panelGrid>

            <p:panelGrid columns="2" layout="grid"
                         columnClasses="ui-grid-col-1,ui-grid-col-11"
                         styleClass="ui-panelgrid-blank"
                         style="border:0px none; background-color:transparent;text-align:left;">
                <p:outputLabel value="备注"/>
                <p:inputText value="#{xhhSettlementPrepayListBean.settlementBill.remark}"/>

                <p:outputLabel value="附件"/>
                <p:outputPanel id="uploadPanel">
                    <p:fileUpload id="uploadAttachment"
                                  style="width: 90px;display: inline-block;"
                                  fileUploadListener="#{xhhSettlementPrepayListBean.onUploadAttachment}"
                                  mode="advanced"
                                  fileLimit="1"
                                  auto="true"
                                  fileLimitMessage="只能上传一个文件"
                                  invalidFileMessage="不支持上传文件类型"
                                  invalidSizeMessage="文件过大"
                                  sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                  allowTypes="/(\.|\/)(#{constants:get('UPLOAD_DOCUMENT_FILE_SUFFIX')})$/"
                                  label="上传" update="uploadPanel" process="@this"/>

                    <p:commandButton update="uploadPanel"
                                     process="@this"
                                     value="删除"
                                     style="margin-left: 50px;"
                                     rendered="#{xhhSettlementPrepayListBean.settlementBill.attachmentUrl!=null}"
                                     actionListener="#{xhhSettlementPrepayListBean.onDeleteAttachment(null)}">
                        <p:confirm header="提示信息" message="是否确定删除?" icon="ui-icon-alert"/>
                    </p:commandButton>
                </p:outputPanel>

                <p:outputLabel value="附件1"/>
                <p:outputPanel id="uploadImgPanel">
                    <p:fileUpload id="uploadImgAttachment"
                                  style="width: 90px;display: inline-block;"
                                  fileUploadListener="#{xhhSettlementPrepayListBean.onUploadImgAttachment}"
                                  mode="advanced"
                                  fileLimit="1"
                                  auto="true"
                                  fileLimitMessage="只能上传一个文件"
                                  invalidFileMessage="不支持上传文件类型"
                                  invalidSizeMessage="文件过大"
                                  sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                  allowTypes="/(\.|\/)(#{constants:get('UPLOAD_DOCUMENT_FILE_SUFFIX')})$/"
                                  label="上传" update="uploadImgPanel" process="@this"/>

                    <p:commandButton update="uploadImgPanel"
                                     process="@this"
                                     value="删除"
                                     style="margin-left: 50px;"
                                     rendered="#{xhhSettlementPrepayListBean.settlementBill.imgAttachmentUrl!=null}"
                                     actionListener="#{xhhSettlementPrepayListBean.onDeleteAttachment('img')}">
                        <p:confirm header="提示信息" message="是否确定删除?" icon="ui-icon-alert"/>
                    </p:commandButton>
                </p:outputPanel>
            </p:panelGrid>
            <p:outputPanel styleClass="ui-g-12">
                <span style="color: red;float: right;">提示：提交不可修改请确认数据准确</span>
            </p:outputPanel>
            <div class="ui-g-12">
                <p:commandButton value="提交" style="float: right"
                                 actionListener="#{xhhSettlementPrepayListBean.onSaveBill()}"
                                 process="@this bill-dialog"/>
            </div>
        </div>
    </p:outputPanel>
</p:dialog>

</html>
